﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SampleWinProject.EchoNext
{
    public partial class frmEchoNext : Form
    {
        String ApiKey = "4TC07NBB4ZFYDVOTI";

        public frmEchoNext()
        {
            InitializeComponent();
        }

        private void btnSelectFile_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txtFile.Text = openFileDialog1.FileName;
            }
        }

        /// <summary>
        /// 上传文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpload_Click(object sender, EventArgs e)
        {
           

            String URL_Format = "http://developer.echonest.com/api/v4/track/upload?api_key={0}&filetype=mp3";
            String URL = String.Format(URL_Format, ApiKey);
            try
            {
                var request = System.Net.HttpWebRequest.Create(URL);
                request.Method = "POST";
                //request.ContentType = "multipart/form-data";
                request.ContentType = "application/octet-stream";
                var stream = request.GetRequestStream();

                byte[] data = new byte[10240];
                int length = 0;
                var reader = System.IO.File.OpenRead(txtFile.Text);
                while ((length = reader.Read(data, 0, data.Length)) > 0)
                {
                    //往流里面写入内容
                    stream.Write(data, 0, length);
                }
                reader.Close();
                stream.Flush();
                var response = request.GetResponse();
                stream = response.GetResponseStream();
                length = stream.Read(data, 0, data.Length);
                String message = UTF8Encoding.UTF8.GetString(data, 0, length);
                txtMessage.Text = message;
                /*第一次上传的反馈信息
                {"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "track": {"status": "pending", "artist": "", "title": "", "release": "", "audio_md5": "5a0f6467e783e69d93aed4da1d23413e", "bitrate": 128, "id": "TRWGGLC13C7B3868BC", "samplerate": 22050, "md5": "1a1b117baa8c1d21d075b4eb30fdf5d3"}}}
                 */
                /*第二次上传反馈的信息
                 * {"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "track": {"status": "pending", "artist": "½­Ñå", "title": "¿µÊ¦¸µÏãÀ±Å£ÈâÃæ", "release": "", "audio_md5": "1a1b117baa8c1d21d075b4eb30fdf5d3", "bitrate": 128, "id": "TRLFTYZ13C7B3AF593", "samplerate": 22050, "md5": "6225502ba96a2a8e81d4cce1d2ec0a08"}}}
                 */
                /*第三次上传反馈的信息
                 * {"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "track": {"status": "pending", "artist": "", "title": "KSFXLNRM", "release": "", "audio_md5": "1a1b117baa8c1d21d075b4eb30fdf5d3", "bitrate": 128, "id": "TRGKNGX13C7BA67BA1", "samplerate": 22050, "md5": "de0d28f764f4ab7b42432519a7a3f13a"}}}
                 */
            }
            catch (Exception err)
            {
                txtMessage.Text = err.Message + err.StackTrace;
            }
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            String URL_Format = "http://developer.echonest.com/api/v4/song/identify?api_key={0}&code={1}&bucket=audio_summary";
           
            String code = "eJxdnImVJCEORF0pE7gR_js28UNkVvXs7ns7SecBQgqFDmqW0modY3zKp8VYs83on97KZ-026qxnf1aJj_45a63nE2t8op8zzpn9U2vzcydGn-dT-173wdnqp67evk_Wo3u_j7aqe7-PtqF7v4-2FfHZ56wV-9POyI_WXWMyu_ejbX_6mL8f7SvKZ8Qos9Sjy7PiU0ufo2598jNaG5--d629nM8Yujl2HaUPrXvsvj6ntNVW7_rrOc3PRptHf55txCdiFw3orXOWkX-uZe_zmXuVT9fAqEMLXKUu_7mNPfXn1Ubh5TtWH_rzbFrh3rHX4HLPpgXvtffQa3fRzTy8Wx-nf3Y763666tNbS_399A7tUZ9r6HXasSgrZ9aOVjIlO4nei64SZ2iinyNh9Fl71VslTj0VdYcEdkrE8-WlP5-O8N8vn1XK75dPSPpaRSlalTa5lLgTL6NJZvqnnvK3Z_B3ieHn41Vf02buE632saVQtV-pVQlnaqBrE_x9yUarqmvE7wRYUvudQast_syg9Rg_M2jL9-_S9Sr-fHR_1LOkbHyw10jh7SEF0JQkgPJIgBd03flnBv1oN7QD0sCCUYxW7gykRdwwhvYjt16v0PXWfnz3vg7tu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eHq_KI6U8-I9zTY3R1h58G9s2bPOgaVB1_M_zhlh5wkYjGd_jwofMM_hGwiKcZYTiUbXEPU71MSXbk1pq3OpOnSYHbku7mpLuB4JMoZcBZMf17ciSXgZXNZbTQHg8QfMpQs1nVJwnKPxu-6qI=";
            String URL = String.Format(URL_Format, ApiKey, code);
            txtSearchCode.Text = code;
            try
            {
                var request = System.Net.HttpWebRequest.Create(URL);
                request.Method = "GET";
              

                byte[] data = new byte[4096];
                int length = 0;
              
                var response = request.GetResponse();
                var stream = response.GetResponseStream();
                length = stream.Read(data, 0, data.Length);
                String message = UTF8Encoding.UTF8.GetString(data, 0, length);
                txtMessage.Text = message;
             }
            catch (Exception err)
            {
                txtMessage.Text = err.Message + err.StackTrace;
            }
        }
    }
}
